package file;

import java.io.File;
import java.io.IOException;

public class Demo2 {
    public static void main(String[] args) throws IOException {
        for (int i = 0; i <= 50; i++) {
            for (int j = 0; j <= 100; j++) {
                File bir = new File("demo" + i);
                if (!bir.exists()) {
                    bir.mkdirs();
                    System.out.println("创建成功");
                }
                File file = new File(bir, "demo" + j + ".txt");
                if (!file.exists()) {
                    file.createNewFile();
                }
            }
        }
        for (int i = 0; i <= 50; i++){
            for (int j = 0; j <= 100; j++){
                File bir = new File("demo" + i);
                if (bir.exists()) {
                    bir.delete();
                    System.out.println("删除成功");
                }
                File file = new File(bir, "demo" + j + ".txt");
                if(file.exists()){
                    file.delete();
                }
                if (bir.exists()) {
                    bir.delete();
                    System.out.println("删除成功");
                }
            }
        }
    }
}
